import http from './axios'
import VueCookies from 'vue-cookies'

const key = '195a9b99ea7a0d259151b5c412bb631b'
let sign
let perid
let vip_id = localStorage.getItem('vipId') || -1
if (process.env.NODE_ENV === 'production') {
  sign = VueCookies.get('wx_sign')
} else {
  sign = '9fdb10f2cf96b45365d565d4f505dee5'
}

export const uploadFileKey = 'Gn1xVdBiTClSSHKZifg0pTQSU5XGagWO'
export const apiList = {
  getOssSign:
    'http://hfc.suoluomei.com/diagnose/public/index.php?s=/admin/photo/getOssAccessKeySecret'
}

/**
 * @msg: 封装默认请求参数
 * @param {Object}
 * @return:
 */
export const post = (url, data = {}) =>
  http
    .post(
      url,
      Object.assign(
        {
          key,
          sign,
          vip_id
        },
        data
      )
    )
    .then(res => {
      return Promise.resolve(res)
    })
